import { defineStore } from "pinia"
import { ref } from "vue"

export const usePersonaStore = defineStore("persona", () => {
  // 存储人设配置状态更新的事件
  const configUpdates = ref<Map<string, boolean>>(new Map())

  // 更新人设配置状态
  const updatePersonaConfig = (personaId: string, hasAvatarConfig: boolean) => {
    configUpdates.value.set(personaId, hasAvatarConfig)
  }

  // 获取人设配置状态
  const getPersonaConfigStatus = (personaId: string): boolean | undefined => {
    return configUpdates.value.get(personaId)
  }

  // 清除特定人设的配置状态
  const clearPersonaConfigStatus = (personaId: string) => {
    configUpdates.value.delete(personaId)
  }

  return {
    configUpdates,
    updatePersonaConfig,
    getPersonaConfigStatus,
    clearPersonaConfigStatus
  }
})
